hysop.backend.device.opencl.opencl_allocator module

class hysop.backend.device.opencl.opencl_allocator.OpenClAllocator(queue, mem_flags=1, verbose=None)[source]

Bases: AllocatorBase

Base class for OpenCl backend allocators.

Initialize a TaggedObject with a tag prefix/postfix/formatter, all optional.

allocate(nbytes, **kwds)[source]

Wraps _allocate_impl to raise an MemoryError if a cl.Error with the is_out_of_memory flag. Should return an hysop.core.memory.buffer.OpenClBuffer

property context
property device
get_context()[source]
get_device()[source]
get_mem_flags()[source]
get_queue()[source]
is_on_host()[source]

Return true if buffers are allocated in host memory.

max_alloc_size()[source]

Max allocatable size in bytes.

property mem_flags
prefix()[source]

Prefix for logs

property queue
class hysop.backend.device.opencl.opencl_allocator.OpenClDeferredAllocator(queue, mem_flags=1, verbose=None)[source]

Bases: OpenClAllocator

Deferred OpenCL allocator, memory is allocated when used on device.

Initialize a TaggedObject with a tag prefix/postfix/formatter, all optional.

is_deferred = True
class hysop.backend.device.opencl.opencl_allocator.OpenClImmediateAllocator(queue, mem_flags=1, verbose=None)[source]

Bases: OpenClAllocator

Immediate OpenCL allocator, memory allocation is not deferred. Convenient for memory pools and to catch allocation errors early.

Initialize a TaggedObject with a tag prefix/postfix/formatter, all optional.

is_deferred = False
memory_pool(name, **kwds)[source]

Construct a memory pool from this allocator.